package org.indp.mongowl.model;

import java.io.Serializable;

/**
 *
 */
public class ConnectionProfile implements Serializable {

    private String host = "localhost";
    private int port = 27017;

    public ConnectionProfile() {
    }

    public ConnectionProfile(String host, int port) {
        this.host = host;
        this.port = port;
    }

    @Override
    public String toString() {
        return getName();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof ConnectionProfile)) return false;

        ConnectionProfile that = (ConnectionProfile) o;

        if (port != that.port) return false;
        if (!host.equals(that.host)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = host.hashCode();
        result = 31 * result + port;
        return result;
    }

    public String getName() {
        return host + ':' + port;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }
}
